<!--
  * 预警
-->
<template>
  <a-card size="small" :bordered="false" :hoverable="true">
    <a-tabs v-model:activeKey="activeKey">
      <a-tab-pane :key="item.value" :tab="`${item.desc}预警规则`" v-for="item in tabList">
        <component :is="warningComponents[item.value as string]" v-if="activeKey === item.value" :key="item.value" />
      </a-tab-pane>
    </a-tabs>
  </a-card>
</template>
<script setup lang="ts">
import NearExpirationList from './near-expiration/near-expiration-list.vue'
import ExpiredList from './expired/expired-list.vue'
import InventoryList from './inventory/inventory-list.vue'

import { useEnums } from '@/hooks/plugins/useEnums'
const { getValueDescList } = useEnums()
const warningComponents = {
  '1': NearExpirationList,
  '2': ExpiredList,
  '3': InventoryList
}
const tabList = reactive(getValueDescList('WARNING_TYPE_ENUM'))
const activeKey = ref<string>(tabList[0].value as string)
</script>
